package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 商品库存表
 * </p>
 *
 * @author cnswhy
 * @since 2020-10-23
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_shop_product_stock")
@ApiModel(value = "ShopProductStock", description = "商品库存表")
@AllArgsConstructor
public class ShopProductStock extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 规格值id组合，例如：718,527,492
     */
    @ApiModelProperty(value = "规格值id组合，例如：718,527,492")
    @NotEmpty(message = "规格值id组合，例如：718,527,492不能为空")
    @Length(max = 1000, message = "规格值id组合，例如：718,527,492长度不能超过1000")
    @TableField(value = "spec_ids", condition = LIKE)
    @Excel(name = "规格值id组合，例如：718,527,492")
    private String specIds;

    /**
     * 规格值组合，例如：红色,大码
     */
    @ApiModelProperty(value = "规格值组合，例如：红色,大码")
    @Length(max = 1000, message = "规格值组合，例如：红色,大码长度不能超过1000")
    @TableField(value = "spec_values", condition = LIKE)
    @Excel(name = "规格值组合，例如：红色,大码")
    private String specValues;

    /**
     * 所属商品id
     */
    @ApiModelProperty(value = "所属商品id")
    @NotNull(message = "所属商品id不能为空")
    @TableField("product_id")
    @Excel(name = "所属商品id")
    private Long productId;

    /**
     * 图片
     */
    @ApiModelProperty(value = "图片")
    @Length(max = 255, message = "图片长度不能超过255")
    @TableField(value = "img_url", condition = LIKE)
    @Excel(name = "图片")
    private String imgUrl;

    /**
     * 商品货号
     */
    @ApiModelProperty(value = "商品货号")
    @Length(max = 50, message = "商品货号长度不能超过50")
    @TableField(value = "product_no", condition = LIKE)
    @Excel(name = "商品货号")
    private String productNo;

    /**
     * 库存
     */
    @ApiModelProperty(value = "库存")
    @TableField("stock")
    @Excel(name = "库存")
    private Long stock;

    /**
     * 成本价
     */
    @ApiModelProperty(value = "成本价")
    @TableField("cost_price")
    @Excel(name = "成本价")
    private BigDecimal costPrice;

    /**
     * 售价
     */
    @ApiModelProperty(value = "售价")
    @TableField("sell_price")
    @Excel(name = "售价")
    private BigDecimal sellPrice;

    /**
     * 原价
     */
    @ApiModelProperty(value = "原价")
    @TableField("original_price")
    @Excel(name = "原价")
    private BigDecimal originalPrice;

    /**
     * 重量
     */
    @ApiModelProperty(value = "重量")
    @TableField("weight")
    @Excel(name = "重量")
    private Float weight;

    /**
     * 库存预警
     */
    @ApiModelProperty(value = "库存预警")
    @TableField("warning")
    @Excel(name = "库存预警")
    private Integer warning;

    /**
     * 状态 0-启用 1-禁用  2-删除
     */
    @ApiModelProperty(value = "状态 0-启用 1-禁用  2-删除")
    @TableField("status")
    @Excel(name = "状态 0-启用 1-禁用  2-删除")
    private Integer status;

    /**
     * 图标
     */
    @ApiModelProperty(value = "图标")
    @Length(max = 255, message = "图标长度不能超过255")
    @TableField(value = "url", condition = LIKE)
    @Excel(name = "图标")
    private String url;


    @Builder
    public ShopProductStock(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    String specIds, String specValues, Long productId, String imgUrl, String productNo, 
                    Long stock, BigDecimal costPrice, BigDecimal sellPrice, BigDecimal originalPrice, Float weight, Integer warning,
                    Integer status, String url) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.specIds = specIds;
        this.specValues = specValues;
        this.productId = productId;
        this.imgUrl = imgUrl;
        this.productNo = productNo;
        this.stock = stock;
        this.costPrice = costPrice;
        this.sellPrice = sellPrice;
        this.originalPrice = originalPrice;
        this.weight = weight;
        this.warning = warning;
        this.status = status;
        this.url = url;
    }

}
